package es.armaplus.commons.tags;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.jsp.JspException;

public class InputTextTag extends ArmaplusTagBase {

	private String name;

	@Override
	public void doTag() throws JspException, IOException {
		String body = "";
		
		Map <String, String> contentProperties = new HashMap<String, String>();
		Map <String, String> inputProperties = new HashMap<String, String>();
		
		inputProperties.put("value", getValue());
		inputProperties.put("type", "text");
		inputProperties.put("name", name);
		contentProperties.put("class", DEFAULT_STYLE);
		body = generateTag(contentProperties, DEFAULT_TAG_CONTENT, 
			generateTag(null,DEFAULT_TAG_LABEL,getLabel()) +
			generateTag(inputProperties, "input", "")
		);
		
		getJspContext().getOut().write(body);
	}

	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
}
